package com.shuyun.classloader;

import java.lang.reflect.Method;

/**
 * @description:
 * @author: shuai.chen@shuyun.com
 * @date: 2021/8/23 2:15 下午
 */
public class LoadClassTest {

    public static void main(String[] args) throws Exception {
        String classPath = "/Users/dashuai/code/shuyun/shuyun-study-skill-example/outer-jar/target/classes/com/shuyun/open/protocol/TaoProtocol.class";
        CustomClassLoader customClassLoader = new CustomClassLoader(classPath);
        Class<?> taoProtocol = Class.forName("com.shuyun.open.protocol.TaoProtocol", true, customClassLoader);
        Object instance = taoProtocol.newInstance();
        System.out.println(instance);
        Method handle = taoProtocol.getDeclaredMethod("handle", null);
        handle.invoke(instance, null);


    }

}
